/*
 * @Author: 李家磊
 * @Date: 2024-04-16 13:30:37
 * @LastEditTime: 2024-04-16 13:30:38
 * @LastEditors: lijialei
 * @Description:
 * @FilePath: /web/src/services/Common/baseInfo.ts
 */
import request from "umi-request";

export async function getAppConfig() {
  const url = `${window.location.origin}/appconfig.json`;
  return request(url);
}

export async function apiUrl() {
  const appConfig = await getAppConfig();
  if (process.env.NODE_ENV == "development") {
    return appConfig.apiUrl.dev;
  }
  else {
    return appConfig.apiUrl.build;
  }
}

export async function filePreViewUrl() {
  const appConfig = await getAppConfig();
  if (process.env.NODE_ENV == "development") {
    return appConfig.filePreViewUrl.dev;
  }
  else {
    return appConfig.filePreViewUrl.build;
  }
}
